<template>
  <d2-container>
    <div class="adminTask" style="background:white;border-radius:5px;">
      <el-tabs v-model="activeName" type="card" style="width:100%;">
        <el-tab-pane label="浏览单" name="first">
          <div style="width:100%;">
            <el-form :model="ruleFormLld" ref="ruleFormLld" label-width="100px"
                     class="demo-ruleForm">
              <div class="lldstyle">
                <div style="margin-top:15px;">
                  <el-form-item label="宝贝ID" prop="babyid" size="mini" label-width="120px">
                    <el-input v-model="ruleFormLld.babyid" style="width: 120px;"></el-input>
                    <el-button style="margin-left:10px;" @click="getGoods('LLD')" :loading="loadgoods" size="mini"
                               type="primary">获取商品详情1
                    </el-button>
                    <el-button style="margin-left:10px;" @click="getGoodsOther('LLD')" :loading="loadgoods" size="mini"
                               type="primary">获取商品详情2
                    </el-button>
                  </el-form-item>
                  <el-form-item label="店铺选择" prop="shopname" size="mini" label-width="120px">
                    <el-select placeholder="请选择" size="mini" v-model="ruleFormLld.shopname"
                               @change="taskvarietys('XLD')">
                      <el-option v-for="(item,index) in tableData4" :label="item.shopname"
                                 :value="item.shopname">
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="商品图片" prop="img" size="mini" label-width="120px" v-if="ruleFormLld.img!=''">
                    <img :src="ruleFormLld.img" style="width: 100px;height:100px;"/>
                  </el-form-item>
                  <el-form-item label="商品标题" prop="shoptitle" size="mini" label-width="120px">
                    <el-input v-model="ruleFormLld.shoptitle" style="width: 260px;"></el-input>
                  </el-form-item>
                  <el-form-item label="活动提示" prop="shoptips" size="mini" label-width="120px">
                    <el-input style="width: 280px" type="text" v-model="ruleFormLld.shoptips"
                              placeholder="给买家的提示内容">
                    </el-input>
                  </el-form-item>
                  <el-form-item label="关键字" prop="goodskey" size="mini" label-width="120px">
                    <el-input v-model="ruleFormLld.goodskey" style="width: 260px;"></el-input>
                  </el-form-item>
                  <el-form-item label="商品价格" prop="goodsprice" size="mini" label-width="120px">
                    <el-input v-model="ruleFormLld.goodsprice" style="width: 260px;"></el-input>
                  </el-form-item>
                  <el-form-item label="问题" prop="goodsproblem" size="mini" label-width="120px">
                    <el-input v-model="ruleFormLld.goodsproblem" style="width: 260px;"></el-input>
                  </el-form-item>
                  <el-form-item label="答案" prop="goodsanswer" size="mini" label-width="120px">
                    <el-input v-model="ruleFormLld.goodsanswer" style="width: 260px;"></el-input>
                  </el-form-item>
                  <el-form-item label="排序方式" size="mini" label-width="120px">
                    <el-radio label="综合" @change="renshu = true" v-model="ruleFormLld.sort">综合</el-radio>
                    <el-radio label="销量" @change="renshu = false" v-model="ruleFormLld.sort">销量</el-radio>
                  </el-form-item>
                  <el-form-item label="筛选方式" size="mini" label-width="120px">
                    <el-radio label="货到付款" @change="renshu = true" v-model="ruleFormLld.filter">货到付款</el-radio>
                    <el-radio label="公益宝贝" @change="renshu = false" v-model="ruleFormLld.filter">公益宝贝</el-radio>
                    <el-radio label="无" @change="renshu = false" v-model="ruleFormLld.filter">无</el-radio>
                  </el-form-item>
                  <el-form-item label="分组" prop="group" size="mini" label-width="120px">
                    <el-select v-model="ruleFormLld.group" placeholder="请选择">
                      <el-option v-for="(item,index) in groups" :key="index" :label="item.label"
                                 :value="item.value"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="活动时间设置" prop="acttime" size="mini" label-width="120px">
                    <el-date-picker
                      v-model="ruleFormLld.acttime"
                      type="date"
                      size="small"
                      placeholder="选择日期"
                      style="width: 260px;"
                      format="yyyy 年 MM 月 dd 日"
                      value-format="timestamp">
                    </el-date-picker>
                  </el-form-item>
                </div>
                <div style="margin-left:80px;">
                  <el-form-item prop="name" size="mini" label-width="200px">
                    <div style="display:flex;">
                      <p style="width:40%;">放单时间：</p>
                      <div class="lldtime">
                        <p class="partone" v-for="(item,index) in timearr" :key="index">
                          <span>
                            <i class="el-icon-time"></i> {{ item.time }}</span>
                          <input type="text" v-model="item.num"/>
                        </p>
                      </div>
                    </div>
                  </el-form-item>
                </div>
              </div>
              <div class="pluses">
                <p v-for="item in plusesList">
                  <el-button size="small" type="primary" style="margin-right:20px;">{{ item.title }}</el-button>
                  <el-radio-group v-model="item.radio">
                    <el-radio :label="list.idx" v-for="list in item.list">{{ list.name }}</el-radio>
                  </el-radio-group>
                  <span style="color:#bbb;margin-left:20px;">（{{ item.text }}<span
                    style="color:red;font-weight:600;">此项免费</span>）</span>
                </p>
              </div>
              <el-form-item style="text-align:center;" v-if="justlook">
                <el-button type="danger" @click="waitPay('ruleFormLld')" style="width:260px;">等待支付
                </el-button>
              </el-form-item>
            </el-form>
          </div>
        </el-tab-pane>
        <!--   销量单-->
        <el-tab-pane label="销量单(订单明细上评价)" name="third">
          <div style="overflow:hidden;width:100%;position: relative;display:flex;justify-content: space-around;">
            <el-form label-position="left" :model="ruleForm" style="margin-top:15px;"
                     ref="ruleForm">
              <el-form-item label="宝贝ID:　　" size="mini" prop="babyId">
                <el-input auto-complete="off" style="width:200px" v-model.trim="ruleForm.babyId"
                          placeholder="请输入宝贝ID">
                  <el-button @click="getShopInfo('XLD')" icon="el-icon-search" slot="append"></el-button>
                </el-input>
                <el-button style="margin-left:10px;" @click="getGoods('XLD')" :loading="loadgoods" size="mini"
                           type="primary">获取商品详情1
                </el-button>
                <el-button style="margin-left:10px;" @click="getGoodsOther('XLD')" :loading="loadgoods" size="mini"
                           type="primary">获取商品详情2
                </el-button>
              </el-form-item>
              <el-form-item label="商品图片:　">
                <el-upload
                  class="avatar-uploader"
                  action="/api/va/cooperationrecharge/bankcardimg"
                  :headers="importHeaders"
                  v-if="ruleForm.img==''"
                  multiple
                  :limit="1"
                  :on-success="handleSuccess">
                  <i class="el-icon-plus avatar-uploader-icon"></i>
                </el-upload>
                <div v-if="ruleForm.img!=''" style="display:flex;">
                  <img :src="ruleForm.img" style="width:50px;height:50px;" alt="">
                  <i class="el-icon-error" @click="handleRemove"></i>
                </div>
              </el-form-item>
              <el-form-item label="SKU选择:" v-show="ruleForm.babyName !=''">
                <el-input v-model="skuname" placeholder="SKU名称(自动填写)" size="small" style="width:200px;"></el-input>
                <el-card style="margin-top:20px;">
                  <div style="width:400px;flex-wrap: wrap">
                    <p>颜色分类：</p>
                    <el-tooltip v-for="i in skuBase" class="item" effect="dark" :content="i.name" placement="top-start">
                        <img :src="i.image" @click="changing(i)" style="width:40px;height:40px;border:1px solid #bababa"
                             alt="">
                    </el-tooltip>
                  </div>
                </el-card>
              </el-form-item>
              <el-form-item label="店铺选择：" size="mini" prop="shop">
                <el-select placeholder="请选择" size="mini" v-model="ruleForm.shop" @change="taskvarietys('XLD')">
                  <el-option v-for="(item,index) in tableData4" :label="item.shopname"
                             :value="item.shopname">
                  </el-option>
                </el-select>
                <el-button @click="$router.push('/bindingshops')" type="danger" style="margin-left:10px;">绑定店铺
                </el-button>
              </el-form-item>
              <el-form-item label="下单类型：" size="mini" prop="shop">
                <el-select placeholder="请选择" size="mini" v-model="ruleForm.ordertypes">
                  <el-option v-for="item in ordergroup" :label="item.label"
                             :value="item.value">
                  </el-option>
                </el-select>
                <el-popover
                  placement="top-start"
                  width="200"
                  trigger="hover"
                  content="如果下单类型不是关键词，则在关键词那一栏写 “二维码下单” ">
                  <el-button slot="reference" type="danger">规则</el-button>
                </el-popover>
                <el-popover
                  placement="top-start"
                  width="200"
                  trigger="hover"
                  content="https://www.shujushe.com/Navigation/6">
                  <el-button slot="reference" type="danger">推荐渠道网站</el-button>
                </el-popover>
              </el-form-item>
              <el-form-item label="上传截图：" v-show="ruleForm.ordertypes!=1">
                <el-upload
                  class="avatar-uploader"
                  action="/api/va/cooperationrecharge/bankcardimg"
                  :headers="importHeaders"
                  v-if="ruleForm.note_img==''"
                  multiple
                  :limit="1"
                  :on-success="handleSuccessnote_img">
                  <i class="el-icon-plus avatar-uploader-icon"></i>
                </el-upload>
                <div v-if="ruleForm.note_img!=''" style="display:flex;">
                  <img :src="ruleForm.note_img" style="width:50px;height:50px;" alt="">
                  <i class="el-icon-error" @click="handleRemovenote_img"></i>
                </div>
              </el-form-item>
              <el-form-item label="商品价格：" size="mini" prop="money">
                <el-input style="width: 150px" v-model="ruleForm.money" placeholder="产品实际成交价格">
                </el-input>
              </el-form-item>
              <el-form-item label="商品标题：" size="mini" prop="babyName">
                <el-input style="width: 135px" v-model="ruleForm.babyName" placeholder="产品的简称">
                </el-input>
              </el-form-item>
              <el-form-item label="是否优惠：" size="mini" style="display:flex;">
                <div style="display:flex;">
                  <el-radio-group v-model="radio1" @change="changes">
                    <el-radio label="1" border>是</el-radio>
                    <el-radio label="2" border>否</el-radio>
                  </el-radio-group>
                </div>
              </el-form-item>
              <el-form-item label="　　　" v-show="showing">
                <el-input style="width: 150px" v-model="ruleForm.task_coupon" placeholder="请写用多少钱的优惠卷">
                </el-input>
                <span style="font-size:14px;color:red;">写应该使用多少钱的优惠卷</span>
              </el-form-item>
              <el-form-item label="发布日期：" style="display:flex;align-items: center;">
                <el-date-picker style="width: 150px;" placeholder="选择日期" size="mini" type="date"
                                value-format="timestamp"
                                v-model="taskInfoListM.time" @change="gettime">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="商家提示：">
                <el-input style="width: 280px" type="textarea" v-model="taskInfoListM.tips" placeholder="给买家的提示内容">
                </el-input>
              </el-form-item>
              <el-form-item label="是否运费：" style="display:flex;align-items: center;">
                <div style="display:flex;">
                  <el-radio-group v-model="ruleForm.freight">
                    <el-radio label="2" border>是</el-radio>
                    <el-radio label="1" border>否</el-radio>
                  </el-radio-group>
                </div>
              </el-form-item>
            </el-form>
            <!-- 左边部分 -->
            <el-form>
              <el-form-item style="margin-top:10px;">
                <span>分组：</span>
                <el-select class="adminTask_select" name="" v-model="taskInfoListM.group" style="width: 175px;">
                  <el-option :value="item.value" :label="item.label" v-for="item in groups"></el-option>
                </el-select>
                <span style="color:red;font-weight:600;margin-left:20px;">默认C组，如果需要修改分组，联系管理员</span>
              </el-form-item>
              <p v-for="item in plusesList" :key="item.text">
                <el-button size="mini" type="primary" style="margin-right:20px;">{{ item.title }}</el-button>
                <el-radio-group v-model="item.radio">
                  <el-radio :label="list.idx" v-for="list in item.list" style="font-size:14px;"
                  >
                    <!--                    @change="radio_things(item)"-->
                    {{ list.name }}
                  </el-radio>
                </el-radio-group>
                <span style="color:#bbb;margin-left:20px;font-size:14px;">（{{ item.text }}<span
                  style="color:red;font-weight:600;font-size:14px;">此项价格为{{ item.MoneyS }}元</span>）</span>
              </p>
            </el-form>
          </div>
          <!--          一单多款-->
          <div style="display:flex;width:100%;align-items: center;margin-bottom:20px;">
            <h5 style="width:80px;">一单多款：</h5>
            <div style="box-shadow: 0 2px 12px 0 rgb(0 0 0/10%);display:flex;width:100%;align-items: center;">
              <div style="display:flex;width:100%;align-items: center;margin-top:20px;">
                <i class="el-icon-circle-plus-outline" v-if="numbers!=6"
                   style="font-size:25px;margin-bottom:20px;"
                   @click="addlists()"></i>
                <div style="display:flex;flex-wrap: wrap;width:80%;margin:0 auto">
                  <div
                    style="box-shadow: 0 2px 12px 0 rgb(0 0 0/10%);padding:20px;display:flex;margin-bottom:20px;margin-left:20px;"
                    v-for="(i,index) in numbers">
                    <div style="display:flex;justify-content:flex-start;flex-direction: column;">
                      <div>
                        <span style="font-size:12px;">宝贝ID{{ index + 1 }}：　　</span>
                        <el-input size="mini" type="text" style="width:50%" v-model="keywording_ID[index]"
                                  placeholder="请输入宝贝ID">
                          <el-button @click="getShopInfokeywording_ID(keywording_ID[index])" icon="el-icon-search"
                                     slot="append"></el-button>
                        </el-input>
                        <el-button style="margin-left:10px;" @click="getGoods_(index)" :loading="loadgoods" size="mini"
                                   type="primary">获取{{ index + 1 }}
                        </el-button>
                        <el-button style="margin-left:10px;" @click="getGoodsOther_(index)" :loading="loadgoods" size="mini"
                                   type="primary">获取{{ index + 1 }}
                        </el-button>
                      </div>
                      <br/>
                      <div style="display:flex;align-items: center;">
                        <span style="font-size:12px;">关键词{{ index + 1 }}：　　</span>
                        <el-input size="mini" type="text" v-model="keywording[index]" style="width:50%"
                                  placeholder="请输入关键词"></el-input>
                      </div>
                      <br/>
                      <div style="display:flex;align-items: center;">
                        <span style="font-size:12px;"> 　主图{{ index + 1 }}：　　　</span>
                        <img v-if="keywording_IMG[index]" :src="keywording_IMG[index]" alt=""
                             style="width:50px;height:50px;margin-left:10px;">
                      </div>
                    </div>
                  </div>
                </div>
                <i class="el-icon-remove-outline" v-if="numbers>0"
                   style="font-size:25px;" @click="deletelists()"></i>
              </div>
            </div>
            <!--            <div style="display:flex;align-items: center;">-->
            <!--              <i class="el-icon-circle-plus-outline" v-if="numbers!=5"-->
            <!--                 style="font-size:50px;width:50px;height:50px;display:flex;align-items: center;"-->
            <!--                 @click="addlists()"></i>-->
            <!--              <div style="display:flex;flex-wrap: wrap;justify-content: space-around;">-->
            <!--                <el-card style="display:flex;margin-bottom:20px;" v-for="(i,index) in numbers">-->
            <!--                  <div style="display:flex;align-items: center;">-->
            <!--                    <span style="font-size:14px;">宝贝ID{{ index + 1 }}：　　</span>-->
            <!--                    <el-input type="text" style="width:50%" v-model="keywording_ID[index]"-->
            <!--                              placeholder="请输入宝贝ID">-->
            <!--                      <el-button @click="getShopInfokeywording_ID(keywording_ID[index])" icon="el-icon-search"-->
            <!--                                 slot="append"></el-button>-->
            <!--                    </el-input>-->
            <!--                    <el-button style="margin-left:10px;" @click="getGoods_(index)" :loading="loadgoods" size="mini"-->
            <!--                               type="primary">获取主图{{ index + 1 }}-->
            <!--                    </el-button>-->
            <!--                  </div>-->
            <!--                  <br/>-->
            <!--                  <div style="display:flex;align-items: center;">-->
            <!--                    <span style="font-size:14px;">关键词{{ index + 1 }}：　　</span>-->
            <!--                    <el-input type="text" v-model="keywording[index]" style="width:50%"-->
            <!--                              placeholder="请输入关键词"></el-input>-->
            <!--                  </div>-->
            <!--                  <br/>-->
            <!--                  <div style="display:flex;align-items: center;">-->
            <!--                    <span style="font-size:14px;"> 　主图{{ index + 1 }}：　　　</span>-->
            <!--                    <img :src="keywording_IMG[index]" alt=""-->
            <!--                         style="width:50px;height:50px;margin-left:10px;">-->
            <!--                  </div>-->
            <!--                  <br/>-->
            <!--                </el-card>-->
            <!--              </div>-->
            <!--              <i class="el-icon-remove-outline" v-if="numbers>0"-->
            <!--                 style="margin-left:20px;font-size:50px;width:80px;height:80px;" @click="deletelists()"></i>-->
            <!--            </div>-->
          </div>
          <!-- 右边部分 -->
          <div class="dialog-footer">
            <el-form style="margin-left: 50px">
              <el-form-item class="task_total" style="">
                任务总数：<span>{{ getTaskNum() }}</span>
                预计本金：<span>{{ getTaskMoney() }}</span>
                预计佣金：<span>{{ getTaskMoney2() }}</span>
                预计总金额：<span>{{ getyjcMoney() }}</span>
              </el-form-item>
            </el-form>
            <el-form>
              <el-card class="blcok" v-for="g in tasknum" :key="g.id">
                <el-form-item :label="'关键词' + g +'：'" :key="g.key" size="mini">
                  <span style="position:relative;left:-86px;">*</span>
                  <input v-model="taskInfoListM.keywords[(g-1)].keyword" class="formInput"/>
                  <div class="formerror_box">关键词{{ g }}不能为空</div>
                  <span style="margin-left:20px;">关键词数量：</span>
                  <el-select v-model="tasknum" style="width: 75px;" size="mini" @change="COnfirms">
                    <el-option v-for="item in 15" :label="item" :value="item">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item>
                  <span>放单时间：</span>
                  <span style="display:inline-block;width:52px;margin-right:5px;" v-for="i in 23"
                        v-if="i <=1 || i >= 8" class="Puttingtime">
                    <template v-if="i <=1 || i>= 8 "> {{ i - 1 }}点</template>
                  </span>
                </el-form-item>
                <el-form-item>
                  <span>原价单数：</span>
                  <el-input size="mini" style="width: 52px;margin-right:5px;"
                            v-for="i in 23" :key="i"
                            v-show="i <=1 || i >=8"
                            oninput="value=value.replace(/[^\d]/g,'')"
                            v-model="taskInfoListM.nums[(g-1)].yj.toNum[i-1]">
                  </el-input>
                </el-form-item>
              </el-card>
            </el-form>
            <div style="text-align:center;">
              <el-button type="primary" style="float:left;margin-left:30px;" size="mini" @click="saveTemplate">保存模板
              </el-button>
              <el-select style="float:left;margin-left:20px;" v-model="taskInfoListM.m" size="mini" filterable
                         placeholder="请选择">
                <el-option v-for="item in templateList" :key="item.template_name" :label="item.template_name"
                           :value="item.id">
                  <span style="float: left">{{ item.template_name }}</span>
                  <span style="float: right; color: #8492a6; font-size: 13px"
                        @click.stop="deleting(item.id)">{{ item.delete }}</span>
                </el-option>
              </el-select>
              <el-button :loading="btnload" type="primary" style="float:left;margin-left:10px;" size="mini"
                         @click="templateChange">应用
              </el-button>
              <el-button @click="dialogTask1 = false" style="float:right;margin-right:28px;margin-bottom:-20px;"
                         size="mini">取 消
              </el-button>
              <el-button @click="payTaskMoney" type="primary" style="float:right;margin-right:20px;"
                         size="mini">
                确认发布
              </el-button>
            </div>
          </div>
        </el-tab-pane>
        <!--   评价单-->
        <el-tab-pane label="评价单" name="second">
          <div style="overflow:hidden;width:100%;position: relative;display:flex;justify-content: space-around;">
            <el-form label-position="left" label-width="155px" :model="ruleFormPld" style="margin-top:15px;"
                     ref="ruleForm">
              <el-form-item label="宝贝ID：" size="mini" prop="babyId">
                <el-input auto-complete="off" style="width:200px" v-model="ruleFormPld.babyid"
                          placeholder="请输入宝贝ID">
                  <el-button @click="getShopInfo('PJD')" icon="el-icon-search" slot="append"></el-button>
                </el-input>
                <el-button style="margin-left:10px;" @click="getGoods('PLD')" :loading="loadgoods" size="mini"
                           type="primary">获取商品详情1
                </el-button>
                <el-button style="margin-left:10px;" @click="getGoodsOther('PLD')" :loading="loadgoods" size="mini"
                           type="primary">获取商品详情2
                </el-button>
              </el-form-item>
              <el-form-item label="商品图片:">
                <el-upload
                  class="avatar-uploader"
                  action="/api/va/cooperationrecharge/bankcardimg"
                  :headers="importHeaders"
                  v-if="ruleFormPld.img==''"
                  multiple
                  :limit="1"
                  :on-success="handleSuccesspjd">
                  <i class="el-icon-plus avatar-uploader-icon"></i>
                </el-upload>
                <div v-if="ruleFormPld.img!=''" style="display:flex;">
                  <img :src="ruleFormPld.img" style="width:50px;height:50px;" alt="">
                  <i class="el-icon-error" @click="handleRemovepjd"></i>
                </div>
              </el-form-item>
              <el-form-item label="店铺选择：" size="mini" prop="shop" label-width="155px">
                <el-select placeholder="请选择" size="mini" v-model="ruleFormPld.shopname" @change="taskvarietys('PJD')">
                  <el-option v-for="(item,index) in tableData4" :label="item.shopname"
                             :value="item.shopname">
                  </el-option>
                </el-select>
                <el-button @click="$router.push('/bindingshops')" type="danger" style="margin-left:10px;">绑定店铺
                </el-button>
              </el-form-item>
              <el-form-item label="实际成交价格：" size="mini" prop="money" label-width="155px">
                <el-input style="width: 150px" v-model="ruleFormPld.goodsprice" placeholder="产品实际成交价格">
                </el-input>
              </el-form-item>
              <el-form-item label="产品名称：" size="mini" prop="babyName" label-width="155px">
                <el-input style="width: 135px" v-model="ruleFormPld.shoptitle" placeholder="产品的简称">
                </el-input>
              </el-form-item>
              <el-form-item label="是否有优惠卷：" size="mini" label-width="155px" style="display:flex;">
                <div style="display:flex;">
                  <el-radio-group v-model="radiopjd" @change="changepjd">
                    <el-radio label="1" border>是</el-radio>
                    <el-radio label="2" border>否</el-radio>
                  </el-radio-group>
                </div>
              </el-form-item>
              <el-form-item label="　　　" v-show="showingpjd">
                <el-input style="width: 150px" v-model="ruleFormPld.task_coupon" placeholder="请写用多少钱的优惠卷">
                </el-input>
                <span style="font-size:14px;color:red;">写应该使用多少钱的优惠卷</span>
              </el-form-item>
              <el-form-item label="活动时间设置：" style="display:flex;align-items: center;">
                <el-date-picker style="width: 150px;" placeholder="选择日期" size="mini" type="date"
                                value-format="timestamp"
                                v-model="ruleFormPld.acttime" @change="gettime">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="活动提示：">
                <el-input style="width: 280px" type="text" v-model="ruleFormPld.shoptips" placeholder="给买家的提示内容">
                </el-input>
              </el-form-item>
              <el-form-item label="是否有运费：" style="display:flex;align-items: center;">
                <div style="display:flex;">
                  <el-radio-group v-model="ruleFormPld.freight">
                    <el-radio label="2" border>是</el-radio>
                    <el-radio label="1" border>否</el-radio>
                  </el-radio-group>
                </div>
              </el-form-item>
            </el-form>
            <!-- 左边部分 -->
            <el-form>
              <el-form-item style="margin-top:10px;">
                <span>分组：</span>
                <el-select class="adminTask_select" name="" v-model="ruleFormPld.group" style="width: 175px;">
                  <el-option :value="item.value" :label="item.label" v-for="item in groups"></el-option>
                </el-select>
                <span style="color:red;font-weight:600;margin-left:20px;">默认C组，如果需要修改分组，联系管理员</span>
              </el-form-item>
              <p v-for="item in plusesList" :key="item.text">
                <el-button size="mini" type="primary" style="margin-right:20px;">{{ item.title }}</el-button>
                <el-radio-group v-model="item.radio">
                  <el-radio :label="list.idx" v-for="list in item.list" style="font-size:14px;"
                            @change="radio_things(item)">
                    {{ list.name }}
                  </el-radio>
                </el-radio-group>
                <span style="color:#bbb;margin-left:20px;font-size:14px;">（{{ item.text }}<span
                  style="color:red;font-weight:600;font-size:14px;">此项价格为{{ item.MoneyS }}元</span>）</span>
              </p>
            </el-form>
          </div>
          <!-- 右边部分 -->
          <div class="dialog-footer">
            <el-form>
              <el-card class="blcok" v-for="g in tasknumPJD" :key="g.id">
                <el-form-item :label="'关键词' + g +'：'" :key="g.key" size="mini">
                  <span style="position:relative;left:-86px;">*</span>
                  <input v-model="ruleFormPld.task_num[(g-1)].Keywords" class="formInput"/>
                  <div class="formerror_box">关键词{{ g }}不能为空</div>
                  <span style="margin-left:20px;">关键词数量：</span>
                  <el-select v-model="tasknumPJD" style="width: 75px;" size="mini">
                    <el-option v-for="item in 7" :label="item" :value="item">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item>
                  <span>总单数：</span>
                  <el-input size="mini" style="width: 52px;margin-left:15px;"
                            :value="sum(ruleFormPld.task_num[(g-1)].TaskNums)"
                            disabled>
                  </el-input>
                </el-form-item>
                <el-form-item>
                  <span>放单时间：</span>
                  <span style="display:inline-block;width:52px;margin-right:5px;" v-for="i in 23"
                        v-if="i <=1 || i >= 8" class="Puttingtime">
                    <template v-if="i <=1 || i>= 8 "> {{ i - 1 }}点</template>
                  </span>
                </el-form-item>
                <el-form-item>
                  <span>销量单数：</span>
                  <el-input size="mini" type="number" style="width:52px;margin-right:5px;"
                            v-for="i in 17" :key="i"
                            v-model.number="ruleFormPld.task_num[(g-1)].TaskNums[i-1]">
                  </el-input>
                </el-form-item>
              </el-card>
              <div style="text-align:center;">
                <el-button @click="dialogTask1 = false" style="float:right;margin-right:28px;margin-bottom:-20px;"
                           size="mini">取 消
                </el-button>
                <el-button @click="waitPayP" type="primary" style="float:right;margin-right:20px;"
                           size="mini">
                  确认发布
                </el-button>
              </div>
            </el-form>
          </div>
        </el-tab-pane>
        <!--   间隔单-->
        <el-tab-pane label="间隔单" name="fourth">
          <div style="width:100%;">
            <el-form :model="ruleFormGED" ref="ruleFormPld" label-width="100px">
              <div class="lldstyle">
                <div style="margin-top:15px;">
                  <el-form-item label="宝贝ID" prop="babyid" size="mini" label-width="120px">
                    <el-input placeholder="请输入商品宝贝ID" v-model="ruleFormGED.babyid" style="width: 120px;"></el-input>
                    <el-button style="margin-left:10px;" @click="getGoods('GYE')" :loading="loadgoods" size="mini"
                               type="danger">获取商品详情1
                    </el-button>
                    <el-button style="margin-left:10px;" @click="getGoodsOther('GYE')" :loading="loadgoods" size="mini"
                               type="danger">获取商品详情2
                    </el-button>
                  </el-form-item>
                  <el-form-item label="商品图片" prop="img" size="mini" label-width="120px">
                    <el-upload
                      class="avatar-uploader"
                      action="/api/va/cooperationrecharge/bankcardimg"
                      :headers="importHeaders"
                      v-if="ruleFormGED.img==''"
                      multiple
                      :limit="1"
                      :on-success="handleSuccessgyd">
                      <i class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                    <div v-if="ruleFormGED.img!=''" style="display:flex;">
                      <img :src="ruleFormGED.img" style="width:50px;height:50px;" alt="">
                      <i class="el-icon-error" @click="handleRemovegyd"></i>
                    </div>
                  </el-form-item>
                  <el-form-item label="店铺选择：" size="mini" prop="shopname" label-width="120px">
                    <el-select placeholder="请选择" size="mini" v-model="ruleFormGED.shopname"
                               @change="taskvarietys('JGD')">
                      <el-option v-for="(item , index) in tableData4" :key="index" :label="item.shopname"
                                 :value="item.shopname">
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="商品名称" prop="shoptitle" size="mini" label-width="120px">
                    <el-input v-model="ruleFormGED.shoptitle" style="width: 260px;"></el-input>
                  </el-form-item>
                  <el-form-item label="关键字" prop="goodskey" size="mini" label-width="120px">
                    <el-input v-model="ruleFormGED.goodskey" style="width: 260px;"></el-input>
                  </el-form-item>
                  <el-form-item label="商品价格" prop="goodsprice" size="mini" label-width="120px">
                    <el-input v-model="ruleFormGED.goodsprice" style="width: 260px;"></el-input>
                  </el-form-item>
                  <el-form-item label="分组" prop="group" size="mini" label-width="120px">
                    <el-select v-model="ruleFormGED.group" placeholder="请选择">
                      <el-option v-for="item in groups" :key="item.value" :label="item.label"
                                 :value="item.value"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="下单方式" prop="group" size="mini" label-width="120px">
                    <el-select v-model="ruleFormGED.orderway" placeholder="请选择">
                      <el-option v-for="item in order_group" :key="item.value" :label="item.label"
                                 :value="item.value"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="任务时间间隔" prop="group" size="mini" label-width="120px">
                    <el-select v-model="ruleFormGED.intervals" placeholder="请选择">
                      <el-option v-for="item in 24" :key="item" :label="item"
                                 :value="item"></el-option>
                    </el-select>
                    <el-popover
                      placement="top-start"
                      width="200"
                      trigger="hover"
                      content="例如：开始时间8月5号7点,设置间隔 24，付款时间8月6号7点">
                      <el-button slot="reference">规则</el-button>
                    </el-popover>
                  </el-form-item>
                  <el-form-item label="是否有优惠卷：" size="mini" label-width="120px" style="display:flex;">
                    <el-radio-group v-model="radiojgd" @change="changejgd">
                      <el-radio label="1" border>是</el-radio>
                      <el-radio label="2" border>否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-form-item label="　　　" v-show="showingjgd">
                    <el-input style="width: 120px;margin-left:20px;" v-model="ruleFormGED.task_coupon"
                              placeholder="请写用多少钱的优惠卷">
                    </el-input>
                    <span style="font-size:14px;color:red;">写使用多少钱的优惠卷</span>
                  </el-form-item>
                  <el-form-item label="活动时间设置" prop="acttime" size="mini" label-width="120px">
                    <el-date-picker
                      v-model="ruleFormGED.acttime"
                      type="date"
                      size="small"
                      placeholder="选择日期"
                      style="width: 260px;"
                      format="yyyy 年 MM 月 dd 日"
                      value-format="timestamp">
                    </el-date-picker>
                  </el-form-item>
                  <el-form-item label="任务提示" prop="shoptips" size="mini" label-width="120px">
                    <el-input v-model="ruleFormGED.shoptips" type="textarea" placeholder="给刷手的提示，比如:需要购买黄色女装 若干件等等"
                              style="width: 260px;"></el-input>
                  </el-form-item>
                  <el-form-item label="是否有运费：" style="display:flex;align-items: center;" label-width="120px">
                    <el-radio-group v-model="ruleFormGED.freight">
                      <el-radio label="2" border>是</el-radio>
                      <el-radio label="1" border>否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </div>
                <div style="margin-left:80px;">
                  <el-form-item prop="name" size="mini" label-width="200px">
                    <div style="display:flex;">
                      <p style="width:40%;">放单时间：</p>
                      <div class="lldtime">
                        <p class="partones" v-for="item in timearrG" :key="item.time">
                          <span>
                            <i class="el-icon-time"></i> {{ item.time }}</span>
                          <input type="text" v-model="item.num"/>
                        </p>
                      </div>
                    </div>
                  </el-form-item>
                </div>
              </div>
              <div class="pluses">
                <p v-for="item in plusesList" :key="item.text">
                  <el-button size="small" type="primary" style="margin-right:20px;">{{ item.title }}</el-button>
                  <el-radio-group v-model="item.radio">
                    <el-radio :label="list.idx" v-for="list in item.list" @change="radio_things(item)">
                      {{ list.name }}
                    </el-radio>
                  </el-radio-group>
                  <span style="color:#bbb;margin-left:20px;">（{{ item.text }}
                      <span style="color:red;font-weight:600;">此项价格为{{ item.MoneyS }}元</span>）
                    </span>
                </p>
              </div>
              <el-form-item style="text-align:center;" v-if="justlook">
                <el-button type="danger" @click="waitPayJ('ruleFormJGD')" style="width:260px;">等待支付
                </el-button>
              </el-form-item>
            </el-form>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
  </d2-container>
</template>
<script>
import {
  ll_task,
  ll_price,
  taskvariety,
  ll_taskcost,
  crawtb,
  taskdate,
  shoplist,
  overnight_taskcost,
  usergetpriceinfo,
  task_cost,
  overnight_task,
  releasetasks,
  userinfo,
  savetemplate,
  templatelist,
  templatedata,
  evaluate_price,
  evaluate_taskcost,
  evaluate_task, crawtb2,
} from '../../../api/api'

export default {
  data() {
    return {
      token: {
        'Token': JSON.parse(localStorage.getItem('token'))
      },
      Listplus: 0,
      skuname: "",
      ordergroup: [
        {
          value: 1,
          label: "关键词"
        },
        {
          value: 2,
          label: "淘宝精选"
        },
        {
          value: 3,
          label: "手淘推荐"
        },
        {
          value: 4,
          label: "淘口令生成二维码"
        },
        {
          value: 5,
          label: "相似宝贝"
        },
      ],
      MoneyS: {},
      activeName: 'third',
      renshu: true,
      taskvarietyData: "",
      numbers: 0,
      keywording_IMG: [],
      btnload: false,
      keywording: [],
      keywording_ID: [],
      radio1: "",
      radiopjd: "",
      radiojgd: "",
      importHeaders: {token: JSON.parse(localStorage.getItem('token'))},
      plusesList: [
        {
          title: '货比三家',
          radio: 0,
          list: [
            {name: '不需要', idx: 0},
            {name: '货比三家', idx: 1},
          ],
          // text: '需要进行几家宝贝货比？'
          text: ""
        },
        {
          title: '拍前聊天',
          radio: 0,
          list: [
            {name: '不聊', idx: 0},
            {name: '聊天', idx: 1},
          ],
          // text: '需要和商家在淘宝上假聊吗？'
          text: ""
        },
        {
          title: '浏览评价',
          radio: 0,
          list: [
            {name: '不需要', idx: 0},
            {name: '需要', idx: 1},
          ],
          // text: '需要浏览主宝贝的评价页面吗？'
          text: ""
        },
        {
          title: '加购物车',
          radio: 0,
          list: [
            {name: '不需要', idx: 0},
            {name: '需要', idx: 1},
          ],
          // text: '需要将主宝贝加入购物车吗？'
          text: ""
        },
        {
          title: '收藏宝贝',
          radio: 0,
          list: [
            {name: '不需要', idx: 0},
            {name: '需要', idx: 1},
          ],
          // text: '需要收藏主宝贝吗？'
          text: ""
        },
        {
          title: '性别筛选',
          radio: 1,
          list: [
            {name: '不筛选', idx: 1},
            {name: '男', idx: 2},
            {name: '女', idx: 3},
          ],
          // text: '需要筛选购买宝贝的性别吗？'
          text: ""
        },
        {
          title: '年龄筛选',
          radio: 0,
          list: [
            {name: '不筛选', idx: 0},
            {name: '0～25', idx: 1},
            {name: '26～100', idx: 2},
            // {name: '36～100', idx: 3},
          ],
          // text: '需要筛选买家的年龄吗？'
          text: ""
        },
      ],
      loading: true,
      groups: [
        {
          label: "A组",
          value: "a"
        },
        {
          label: "B组",
          value: "b"
        },
        {
          label: "C组",
          value: "c"
        },
        {
          label: "ee组",
          value: "ee"
        }
      ],
      list: {},
      order_group: [
        {
          value: 1,
          label: "足迹"
        },
        {
          value: 2,
          label: "购物车"
        },
        {
          value: 3,
          label: "收藏"
        },
        {
          value: 4,
          label: "搜索"
        },
      ],
      tipsShow: false,
      Month: "",
      DateDay: "",
      dayNum: "",
      payOk: false,
      tasknum: 1,
      tasknumPJD: 1,
      taskInfoListM: {
        sku_properties_name:"",//sku
        task_coupon: 0, //优惠卷
        freight: "",//运费
        compare: "",//货比
        actor: "",//假聊
        browse: "",//浏览
        shop_cart: "",//购物车
        favorites: "",//收藏
        generation: "",//年龄划分
        repeat: 20,//性别
        tips: "",
        note_img: "",
        m: '',
        time: '',
        group: "c",
        money2: 0,
        money: 0,
        babyId: "",
        keywords: [
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          }
        ],
        nums: [
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],

            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
          {
            yj: {
              toNum: [],
            },
          },
        ]
      },
      value: "",
      keywords: [],
      tableData: [],
      searchList: {
        search: "user",
        searchValue: "",
        filter: {
          user: "",
          taskStatus: ""
        },
        pn: 1,
        total: 0
      },
      multipleSelection: [],
      commission: [],
      templateList: [],
      tableData4: [],
      activeDate: "",
      islook: true,
      loadgoods: false,
      timearr: [
        {time: '0点', num: 0},
        {time: '7点', num: 0},
        {time: '8点', num: 0},
        {time: '9点', num: 0},
        {time: '10点', num: 0},
        {time: '11点', num: 0},
        {time: '12点', num: 0},
        {time: '13点', num: 0},
        {time: '14点', num: 0},
        {time: '15点', num: 0},
        {time: '16点', num: 0},
        {time: '17点', num: 0},
        {time: '18点', num: 0},
        {time: '19点', num: 0},
        {time: '20点', num: 0},
        {time: '21点', num: 0},
        {time: '22点', num: 0}
      ],
      timearrP: [
        {time: '0', num: 0},
        {time: '7', num: 0},
        {time: '8', num: 0},
        {time: '9', num: 0},
        {time: '10', num: 0},
        {time: '11', num: 0},
        {time: '12', num: 0},
        {time: '13', num: 0},
        {time: '14', num: 0},
        {time: '15', num: 0},
        {time: '16', num: 0},
        {time: '17', num: 0},
        {time: '18', num: 0},
        {time: '19', num: 0},
        {time: '20', num: 0},
        {time: '21', num: 0},
        {time: '22', num: 0}
      ],
      timearrG: [
        {time: '0点', num: 0},
        {time: '7点', num: 0},
        {time: '8点', num: 0},
        {time: '9点', num: 0},
        {time: '10点', num: 0},
        {time: '11点', num: 0},
        {time: '12点', num: 0},
        {time: '13点', num: 0},
        {time: '14点', num: 0},
        {time: '15点', num: 0},
        {time: '16点', num: 0},
        {time: '17点', num: 0},
        {time: '18点', num: 0},
        {time: '19点', num: 0},
        {time: '20点', num: 0},
        {time: '21点', num: 0},
        {time: '22点', num: 0}
      ],
      counting: 0, //判断时间是否合法 计数
      ruleForm: {
        task_coupon: 0,
        freight: "",
        pjdNum: '0',
        ordertypes: 1,
        babyId: "",
        shop: "",
        money: 0,
        note_img: "",
        Smoney: "",
        babyName: "",
        img: "",
        keywords: [
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          },
          {
            keyword: ""
          }
        ]
      },
      ruleFormLld: {
        babyid: '',
        shopname: '',
        shoptips: '',
        goodskey: '',
        goodsprice: '',
        goodsproblem: '',
        goodsanswer: '',
        acttime: '',
        img: '',
        sort: '综合',
        filter: '无',
        shoptitle: '',
        group: 'c',
      },
      ruleFormPld: {
        task_num: [
          {
            TaskNums: [],
            Keywords: "",
          },
          {
            TaskNums: [],
            Keywords: "",
          },
          {
            TaskNums: [],
            Keywords: "",
          },
          {
            TaskNums: [],
            Keywords: "",
          },
          {
            TaskNums: [],
            Keywords: "",
          },
          {
            TaskNums: [],
            Keywords: "",
          },
          {
            TaskNums: [],
            Keywords: "",
          }
        ],
        task_coupon: 0,
        freight: "",
        compare: "",//货比
        actor: "",//假聊
        browse: "",//浏览
        shop_cart: "",//购物车
        favorites: "",//收藏
        generation: "",//年龄划分
        babyid: '',
        shopname: '',
        shoptips: '',
        orderway: "",
        intervals: null,
        goodskey: '',
        goodsprice: '',
        acttime: '',
        img: '',
        sort: '综合',
        filter: '无',
        shoptitle: '',
        group: 'c',
      },
      ruleFormGED: {
        task_coupon: 0,
        freight: "",
        babyid: '',
        shopname: '',
        shoptips: '',
        orderway: "",
        intervals: null,
        goodskey: '',
        goodsprice: '',
        acttime: '',
        img: '',
        sort: '综合',
        filter: '无',
        shoptitle: '',
        group: 'c',
      },
      skuBase: [],
      arrlist: [],
      arrlisting: [],
      justlook: true,
      MoneySH: 0,
      MoneySP: 0,
      MoneySL: 0,
      MoneySJ: 0,
      MoneySS: 0,
      MoneySN: 0,
      counts: 0,
      showing: false,
      showingpjd: false,
      showingjgd: false,
      getExcalList: [],
    };
  },
  methods: {
    changing(item){
      this.skuname = item.name
      this.taskInfoListM.sku_properties_name = '颜色分类:'+this.skuname+';'
    },
    COnfirms(val) {
      // this.taskInfoListM.keywords.splice(val, this.taskInfoListM.keywords.length - val);
      // for (let i = 0; i < val; i++) {
      //   this.taskInfoListM.keywords.push({keyword: ""})
      // }
      console.log(val);
      console.log(this.taskInfoListM);
    },
    changejgd(val) {
      if (val == "1") {
        this.showingjgd = true
      } else if (val == "2") {
        this.showingjgd = false
      }
    },
    getShopInfokeywording_ID(val) {
      var url = "https://detail.tmall.com/item.htm?id=" + val
      window.open(url)
    },
    changes(val) {
      if (val == "1") {
        this.showing = true
      } else if (val == "2") {
        this.showing = false
      }
    },
    changepjd(val) {
      if (val == "1") {
        this.showingpjd = true
      } else if (val == "2") {
        this.showingpjd = false
      }
    },
    handleSuccessgyd(res) {
      this.ruleFormGED.img = res.UrlImg
    },
    handleRemovegyd() {
      this.ruleFormGED.img = ''
    },
    handleSuccess(res) {
      this.ruleForm.img = res.UrlImg
    },
    handleSuccessnote_img(res) {
      this.ruleForm.note_img = res.UrlImg
    },
    handleRemovenote_img(res) {
      this.ruleForm.note_img = ""
    },
    handleSuccesspjd(res) {
      this.ruleFormPld.img = res.UrlImg
    },
    handleRemove() {
      this.ruleForm.img = ''
    },
    handleRemovepjd() {
      this.ruleFormPld.img = ''
    },
    deleting(id) {
      let _this = this;
      _this.$axios
        .post("/api/va/cooperationtemplate/templatedelect", {
          pay_id: id,
        })
        .then(function (response) {
          console.log(response);
          if (response.data.Status == 200) {
            _this.getTemplateList();
          }
        });
    },
    //选择SKU例如(货币，加购，假聊之类的)
    radio_things(val) {
      if (val.title == "货比三家") {
        if (val.radio != 0) {
          this.MoneySH = val.MoneyS
        } else {
          this.MoneySH = 0
        }
      } else if (val.title == "拍前聊天") {
        if (val.radio != 0) {
          this.MoneySP = val.MoneyS
        } else {
          this.MoneySP = 0
        }
      } else if (val.title == "浏览评价") {
        if (val.radio != 0) {
          this.MoneySL = val.MoneyS
        } else {
          this.MoneySL = 0
        }
      } else if (val.title == "加购物车") {
        if (val.radio != 0) {
          this.MoneySJ = val.MoneyS
        } else {
          this.MoneySJ = 0
        }
      } else if (val.title == "收藏宝贝") {
        if (val.radio != 0) {
          this.MoneySS = val.MoneyS
        } else {
          this.MoneySS = 0
        }
      } else if (val.title == "年龄筛选") {
        if (val.radio != 0) {
          this.MoneySN = val.MoneyS
        } else {
          this.MoneySN = 0
        }
      }
      this.Listplus = this.MoneySH + this.MoneySP + this.MoneySL + this.MoneySJ + this.MoneySS + this.MoneySN
      console.log(this.Listplus);
    },
    //减少一单多款
    deletelists() {
      this.keywording.pop()
      this.keywording_ID.pop()
      this.keywording_IMG.pop()
      if (this.numbers < 1) {
        this.$message({
          type: "error",
          message: "最少得有一列"
        })
      } else {
        this.numbers--
      }
    },
    //添加一单多款
    addlists() {
      console.log(this.numbers);
      if (this.numbers >= 6) {
        this.$message({
          type: "error",
          message: "最多增加六列"
        })
      } else {
        this.numbers++
      }
    },
    //支付间隔
    waitPayJ() {
      if (this.ruleFormGED.goodsprice == '' || this.ruleFormGED.goodsprice == '0') {
        return this.$message.error('请输入价格')
      }
      let allnum = 0
      this.arrlist = []
      this.timearrG.forEach(item => {
        allnum += Number(item.num)
        this.arrlist.push(Number(item.num))
      })
      let params = {
        shopname: this.ruleFormGED.shopname
      }
      taskvariety(params).then(res => {
        console.log(res.MoneyS);
        if (res.Status == 200) {
          let allmoney = res.MoneyS.gyd_money + Number(this.ruleFormGED.goodsprice) * allnum
            + this.getMoney(Number(this.ruleFormGED.goodsprice)) + this.Listplus
          if (allmoney > 0) {
            this.$confirm("您提交的任务数为" + allnum + "，本次将花费" + allmoney + "元，请核对无误后再提交", '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              overnight_taskcost({
                type: 'g',
                task_coupon: Number(this.ruleFormGED.task_coupon),
                freight: this.ruleFormGED.freight,
                orderway: this.ruleFormGED.orderway,
                intervals: this.ruleFormGED.intervals,
                goodsname: this.ruleFormGED.shoptitle,
                baby_id: this.ruleFormGED.babyid,
                price: Number(this.ruleFormGED.goodsprice),
                shopname: this.ruleFormGED.shopname,
                task_num: this.arrlist,
                group: this.ruleFormGED.group,
                key_world: this.ruleFormGED.goodskey,
                problem_one: this.ruleFormGED.goodsproblem,
                answer_one: this.ruleFormGED.goodsanswer,
                sort_order: this.ruleFormGED.sort,
                race_selection: this.ruleFormGED.filter,
                img: this.ruleFormGED.img,
                filter: this.ruleFormGED.shoptips,
                time: this.ruleFormGED.acttime,
                repeat: this.plusesList[5].radio.toString(),
                compare: this.plusesList[0].radio,
                actor: this.plusesList[1].radio,
                browse: this.plusesList[2].radio,
                shop_cart: this.plusesList[3].radio,
                favorites: this.plusesList[4].radio,
                generation: this.plusesList[6].radio,
              }).then(res => {
                if (res.Status == 200) {
                  this.$message({
                    type: 'success',
                    message: res.Message
                  });
                  overnight_task({
                    type: 'g',
                    task_coupon: Number(this.ruleFormGED.task_coupon),
                    freight: this.ruleFormGED.freight,
                    goodsname: this.ruleFormGED.shoptitle,
                    orderway: this.ruleFormGED.orderway,
                    intervals: this.ruleFormGED.intervals,
                    baby_id: this.ruleFormGED.babyid,
                    price: Number(this.ruleFormGED.goodsprice),
                    shopname: this.ruleFormGED.shopname,
                    task_num: this.arrlist,
                    group: this.ruleFormGED.group,
                    key_world: this.ruleFormGED.goodskey,
                    problem_one: this.ruleFormGED.goodsproblem,
                    answer_one: this.ruleFormGED.goodsanswer,
                    sort_order: this.ruleFormGED.sort,
                    race_selection: this.ruleFormGED.filter,
                    img: this.ruleFormGED.img,
                    filter: this.ruleFormGED.shoptips,
                    time: this.ruleFormGED.acttime,
                    repeat: this.plusesList[5].radio.toString(),
                    compare: this.plusesList[0].radio,
                    actor: this.plusesList[1].radio,
                    browse: this.plusesList[2].radio,
                    shop_cart: this.plusesList[3].radio,
                    favorites: this.plusesList[4].radio,
                    generation: this.plusesList[6].radio,
                  }).then(res => {
                    if (res.Status == 200) {
                      this.$message.success(res.Message)
                      this.$router.go(0)
                      this.getUser()
                    }
                  })
                } else {
                  this.$message({
                    type: 'error',
                    message: res.Message
                  });
                }
              })
            }).catch(() => {
              this.$message({
                type: 'info',
                message: '已取消支付'
              });
            });
          } else {
            this.$message({
              type: 'error',
              message: '请正确填写放单数量!'
            });
          }
        }
      })
    },
    // 支付浏览
    waitPay(formName) {
      if (this.ruleFormLld.goodsprice == '' || this.ruleFormLld.goodsprice == '0') {
        return this.$message.error('请输入价格')
      }
      this.$refs[formName].validate((valid) => {
        if (valid) {
          let allnum = 0
          this.arrlist = []
          this.timearr.forEach(item => {
            allnum += Number(item.num)
            this.arrlist.push(Number(item.num))
          })
          ll_price().then(res => {
            if (res.Status == 200) {
              let allmoney = res.Data * allnum
              if (allmoney > 0) {
                this.$confirm("您提交的任务数为" + allnum + "，本次将花费" + allmoney + "元，请核对无误后再提交", '提示', {
                  confirmButtonText: '确定',
                  cancelButtonText: '取消',
                  type: 'warning'
                }).then(() => {
                  ll_taskcost({
                    type: 'l',
                    goodsname: this.ruleFormLld.shoptitle,
                    baby_id: this.ruleFormLld.babyid,
                    price: Number(this.ruleFormLld.goodsprice),
                    shopname: this.ruleFormLld.shopname,
                    task_num: this.arrlist,
                    group: this.ruleFormLld.group,
                    key_world: this.ruleFormLld.goodskey,
                    problem_one: this.ruleFormLld.goodsproblem,
                    answer_one: this.ruleFormLld.goodsanswer,
                    sort_order: this.ruleFormLld.sort,
                    race_selection: this.ruleFormLld.filter,
                    img: this.ruleFormLld.img,
                    filter: this.ruleFormLld.shoptips,
                    time: this.ruleFormLld.acttime,
                    repeat: this.plusesList[5].radio,
                  }).then(res => {
                    if (res.Status == 200) {
                      this.$message({
                        type: 'success',
                        message: res.Message
                      });
                      ll_task({
                        type: 'l',
                        goodsname: this.ruleFormLld.shoptitle,
                        baby_id: this.ruleFormLld.babyid,
                        price: (this.ruleFormLld.goodsprice),
                        shopname: this.ruleFormLld.shopname,
                        task_num: this.arrlist,
                        group: this.ruleFormLld.group,
                        key_world: this.ruleFormLld.goodskey,
                        problem_one: this.ruleFormLld.goodsproblem,
                        answer_one: this.ruleFormLld.goodsanswer,
                        sort_order: this.ruleFormLld.sort,
                        race_selection: this.ruleFormLld.filter,
                        img: this.ruleFormLld.img,
                        filter: this.ruleFormLld.shoptips,
                        time: this.ruleFormLld.acttime
                      }).then(res => {
                        if (res.Status == 200) {
                          this.$message.success(res.Message)
                          this.$router.go(0)
                          this.getUser()
                        }
                      })
                    } else {
                      this.$message({
                        type: 'error',
                        message: res.Message
                      });
                    }
                  })
                }).catch(() => {
                  this.$message({
                    type: 'info',
                    message: '已取消支付'
                  });
                });
              } else {
                this.$message({
                  type: 'error',
                  message: '请正确填写放单数量!'
                });
              }
            }
          })
        } else {
          return false;
        }
      });
    },
    //支付评价单
    waitPayP() {
      console.log(this.ruleFormPld.acttime);
      console.log(new Date(new Date().toLocaleDateString()).getTime());
      if (this.ruleFormPld.acttime > new Date(new Date().toLocaleDateString()).getTime() || this.ruleFormPld.acttime == null) {
        this.paywaitpayP()
      } else {
        this.timearrP.forEach((item) => {
          item.time = item.time.substring(0, item.time.length - 1)
          if (item.num != 0 || item.num != '0') {
            if (new Date().getHours() > Number(item.time)) {
              this.counts++
            }
          }
        })
        if (this.counts == 0) {
          this.paywaitpayP()
        } else {
          this.$message({
            type: 'error',
            message: "您不可以放小于当前时间点的单子"
          })
          setTimeout(() => {
            this.$router.go(0)
          }, 2000)
        }
      }
    },
    paywaitpayP() {
      if (this.ruleFormPld.acttime < new Date(new Date().toLocaleDateString()).getTime() || this.ruleFormPld.acttime == null) {
        this.$message({
          type: "error",
          message: '当前选择时间不合法'
        })
      } else {
        if (this.ruleFormPld.goodsprice == '' || this.ruleFormPld.goodsprice == '0') {
          return this.$message.error('请输入价格')
        }
        let allnum = 0
        this.arrlist = []
        this.arrlisting = []
        this.ruleFormPld.task_num.forEach((item) => {
          item.TaskNums.forEach(item => {
            allnum += Number(item)
          })
          if (item.Keywords != "") {
            this.arrlisting.push({task_nums: item.TaskNums, Keywords: item.Keywords})
          }
        })
        evaluate_price().then(res => {
          if (res.Status == 200) {
            var allmoney = (this.getMoney(this.ruleFormPld.goodsprice) +
              Number(this.ruleFormPld.goodsprice) + res.Data) * allnum + this.Listplus
            if (allmoney > 0) {
              this.$confirm("您提交的任务数为" + allnum + "，本次将花费" + allmoney + "元，请核对无误后再提交", '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => {
                evaluate_taskcost({
                  type: 'p',
                  task_coupon: Number(this.ruleFormPld.task_coupon),
                  freight: this.ruleFormPld.freight,
                  goodsname: this.ruleFormPld.shoptitle,
                  baby_id: this.ruleFormPld.babyid,
                  price: Number(this.ruleFormPld.goodsprice),
                  shopname: this.ruleFormPld.shopname,
                  task_num: this.arrlisting,
                  group: this.ruleFormPld.group,
                  key_world: this.ruleFormPld.goodskey,
                  sort_order: this.ruleFormPld.sort,
                  race_selection: this.ruleFormPld.filter,
                  img: this.ruleFormPld.img,
                  filter: this.ruleFormPld.shoptips,
                  time: this.ruleFormPld.acttime,
                  repeat: this.plusesList[5].radio.toString(),
                  compare: this.plusesList[0].radio,
                  actor: this.plusesList[1].radio,
                  browse: this.plusesList[2].radio,
                  shop_cart: this.plusesList[3].radio,
                  favorites: this.plusesList[4].radio,
                  generation: this.plusesList[6].radio,
                }).then(res => {
                  if (res.Status == 200) {
                    this.$message({
                      type: 'success',
                      message: res.Message
                    });
                    evaluate_task({
                      type: 'p',
                      task_coupon: Number(this.ruleFormPld.task_coupon),
                      freight: this.ruleFormPld.freight,
                      goodsname: this.ruleFormPld.shoptitle,
                      baby_id: this.ruleFormPld.babyid,
                      price: Number(this.ruleFormPld.goodsprice),
                      shopname: this.ruleFormPld.shopname,
                      task_num: this.arrlisting,
                      group: this.ruleFormPld.group,
                      key_world: this.ruleFormPld.goodskey,
                      sort_order: this.ruleFormPld.sort,
                      race_selection: this.ruleFormPld.filter,
                      img: this.ruleFormPld.img,
                      filter: this.ruleFormPld.shoptips,
                      time: this.ruleFormPld.acttime,
                      repeat: this.plusesList[5].radio.toString(),
                      compare: this.plusesList[0].radio,
                      actor: this.plusesList[1].radio,
                      browse: this.plusesList[2].radio,
                      shop_cart: this.plusesList[3].radio,
                      favorites: this.plusesList[4].radio,
                      generation: this.plusesList[6].radio,
                    }).then(res => {
                      if (res.Status == 200) {
                        this.$message.success(res.Message)
                        this.$router.go(0)
                        this.getUser()
                      }
                    })
                  } else if (res.Status == 302) {
                    this.$message({
                      type: 'error',
                      message: res.Message
                    });
                    this.$router.push('/evaluation')
                  } else {
                    this.$message({
                      type: 'error',
                      message: res.Message
                    });
                  }
                })
              }).catch(() => {
                this.$message({
                  type: 'info',
                  message: '已取消支付'
                });
              });
            } else {
              this.$message({
                type: 'error',
                message: '请正确填写放单数量!'
              });
            }
          }
        })
      }
    },
    //支付销量单
    payTaskMoney() {
      if (this.taskInfoListM.time > new Date(new Date().toLocaleDateString()).getTime() || this.taskInfoListM.time == null) {
        this.chenga()
      } else {
        this.taskInfoListM.nums.forEach((item) => {
          item.yj.toNum.forEach((i, index) => {
            if (i != 0 || i != '0') {
              if (new Date().getHours() > index) {
                this.counting++
              }
            }
          })
        })
        if (this.counting == 0) {
          this.chenga()
        } else {
          this.$message({
            type: 'error',
            message: "您不可以放小于当前时间点的单子"
          })
          this.counting = 0
        }
      }
    },
    chenga() {
      if (this.taskInfoListM.time < new Date(new Date().toLocaleDateString()).getTime() || this.taskInfoListM.time == null) {
        this.$message({
          type: "error",
          message: '当前选择时间不合法'
        })
      } else {
        let _this = this;
        if (_this.TaskMoney * 1 + _this.TaskMoney2 * 1 == 0) {
          _this.$message({
            type: "error",
            message: "支付金额不能为0"
          });
          return;
        }
        let lastMoney = 0;
        lastMoney =
          _this.TaskMoney * 1 +
          _this.TaskMoney2 * 1
        lastMoney = lastMoney + _this.Listplus + _this.numbers * Number(_this.taskvarietyData)
        _this.$confirm(
          "您提交的任务数为" + _this.TaskNum + "，本次将花费" + lastMoney.toFixed(2) + "元，请核对无误后再提交", "提示",
          {
            confirmButtonText: "提交",
            cancelButtonText: "取消",
            customClass: "custom"
          }
        )
          .then(() => {
            _this.taskInfoListM.babyId = _this.ruleForm.babyId;
            _this.taskInfoListM.shop = _this.ruleForm.shop;
            _this.taskInfoListM.money = _this.ruleForm.money;
            _this.taskInfoListM.babyName = _this.ruleForm.babyName;
            _this.taskInfoListM.img = _this.ruleForm.img;
            _this.taskInfoListM.note_img = _this.ruleForm.note_img;
            _this.taskInfoListM.task_coupon = Number(_this.ruleForm.task_coupon);
            _this.taskInfoListM.freight = _this.ruleForm.freight;
            _this.taskInfoListM.compare = _this.plusesList[0].radio
            _this.taskInfoListM.actor = _this.plusesList[1].radio
            _this.taskInfoListM.browse = _this.plusesList[2].radio
            _this.taskInfoListM.shop_cart = _this.plusesList[3].radio
            _this.taskInfoListM.favorites = _this.plusesList[4].radio
            _this.taskInfoListM.repeat = _this.plusesList[5].radio
            _this.taskInfoListM.generation = _this.plusesList[6].radio
            if (_this.keywording.length != 0 && _this.keywording_ID.length != 0 && _this.keywording_IMG.length != 0) {
              _this.taskInfoListM.tips = _this.taskInfoListM.tips + '+++***' + _this.keywording + '+++***' + _this.keywording_ID + '+++***' + _this.keywording_IMG
            }
            var releasetaskv2Params = {
              Data: JSON.stringify(_this.taskInfoListM),
            }
            //费用扣除接口
            task_cost(releasetaskv2Params).then(res => {
              if (res.Status == 200) {
                _this.payOk = true;
                this.addTaskM()
                this.getUser()
              }
              _this.$message({
                type: res.Status,
                message: res.Message
              })
            })
          });
      }
    },
    //获取副商品详情
    getGoodsOther_(index) {
      if (this.ruleForm.shop) {
        this.taskvarietys('XLD')
      }
      this.loadgoods = true
      let params = {
        id: this.keywording_ID[index]
      }
      crawtb2(params).then(res => {
        this.loadgoods = false
        if (res.Status == 200) {
          if (res.Data.amp_img != '') {
            this.keywording_IMG[index] = res.Data.amp_img
            this.keywording[index] = res.Data.title
          } else {
            this.$message.error('获取商品信息失败，请手动填写')
          }
        } else {
          this.$message.error('获取商品信息失败，请手动填写')
        }
      })
    },
    //获取副商品详情
    getGoods_(index) {
      if (this.ruleForm.shop) {
        this.taskvarietys('XLD')
      }
      this.loadgoods = true
      let params = {
        id: this.keywording_ID[index]
      }
      crawtb(params).then(res => {
        this.loadgoods = false
        if (res.Status == 200) {
          if (res.Data.amp_img != '') {
            this.keywording_IMG[index] = res.Data.amp_img
            this.keywording[index] = res.Data.title
          } else {
            this.$message.error('获取商品信息失败，请手动填写')
          }
        } else {
          this.$message.error('获取商品信息失败，请手动填写')
        }
      })
    },
    //获取商品详情
    getGoodsOther(str){
      this.loadgoods = true
      let params = {
        id: null
      }
      if (str == 'LLD') {
        params.id = this.ruleFormLld.babyid
      } else if (str == 'PLD') {
        params.id = this.ruleFormPld.babyid
      } else if (str == 'XLD') {
        params.id = this.ruleForm.babyId
      } else if (str == 'GYE') {
        params.id = this.ruleFormGED.babyid
      }
      crawtb2(params).then(res => {
        this.loadgoods = false
        if (res.Status == 200 && res.Data.amp_img != '') {
          console.log(res.Data);
          if (str == 'LLD') {
            this.ruleFormLld.img = res.Data.amp_img
            this.ruleFormLld.shoptitle = res.Data.title
          } else if (str == 'PLD') {
            console.log(res.Data);
            this.ruleFormPld.img = res.Data.amp_img
            this.ruleFormPld.shoptitle = res.Data.title
          } else if (str == 'XLD') {
            console.log(this.ruleForm);
            this.ruleForm.img = res.Data.amp_img
            this.ruleForm.babyName = res.Data.title
            if(res.Data.skuBase.props!=null){
              this.skuBase = res.Data.skuBase.props[0].values
            }
          } else {
            console.log(res.Data);
            this.ruleFormGED.shoptitle = res.Data.title
            this.ruleFormGED.img = res.Data.amp_img
            this.ruleFormGED.babyName = res.Data.title
          }
        } else {
          this.$message.error('获取商品信息失败，请手动填写')
        }
      })
    },
    //获取商品详情
    getGoods(str) {
      this.loadgoods = true
      let params = {
        id: null
      }
      if (str == 'LLD') {
        params.id = this.ruleFormLld.babyid
      } else if (str == 'PLD') {
        params.id = this.ruleFormPld.babyid
      } else if (str == 'XLD') {
        params.id = this.ruleForm.babyId
      } else if (str == 'GYE') {
        params.id = this.ruleFormGED.babyid
      }
      crawtb(params).then(res => {
        this.loadgoods = false
        if (res.Status == 200 && res.Data.amp_img != '') {
          console.log(res.Data);
          if (str == 'LLD') {
            this.ruleFormLld.img = res.Data.amp_img
            this.ruleFormLld.shoptitle = res.Data.title
          } else if (str == 'PLD') {
            console.log(res.Data);
            this.ruleFormPld.img = res.Data.amp_img
            this.ruleFormPld.shoptitle = res.Data.title
          } else if (str == 'XLD') {
            console.log(this.ruleForm);
            this.ruleForm.img = res.Data.amp_img
            this.ruleForm.babyName = res.Data.title
            if(res.Data.skuBase.props!=null){
              this.skuBase = res.Data.skuBase.props[0].values
            }
          } else {
            console.log(res.Data);
            this.ruleFormGED.shoptitle = res.Data.title
            this.ruleFormGED.img = res.Data.amp_img
            this.ruleFormGED.babyName = res.Data.title
          }
        } else {
          this.$message.error('获取商品信息失败，请手动填写')
        }
      })
    },
    gettime(a) {
      let now = new Date();
      let b = now.setHours(0, 0, 0, 0);
      if (a < b) {
        this.$message({
          message: '选择时间不能小于当前时间',
          type: 'warning'
        });
        this.ruleFormPld.acttime = now.setHours(0, 0, 0, 0);
        this.taskInfoListM.time = now.setHours(0, 0, 0, 0);
      }
    },
    //应用保存模板
    templateChange() {
      this.btnload = true
      this.getTemplate()
    },
    //发布任务弹框
    getTemplateList() {
      let _this = this;
      _this.islook = true
      _this.justlook = true
      if (this.tableData4 == []) {
        _this.$message.error("请先绑定店铺！")
      } else {
        templatelist().then(res => {
          if (res.Status == 200) {
            _this.templateList = res.Data.map((item) => {
              _this.$set(item, 'delete', 'X');
              return item
            })
          }
        })
        _this.dialogTask1 = true;
        _this.islook = true
        _this.taskInfoListM.m = ''
      }
    },
    //回调应用保存模板
    getTemplate() {
      let _this = this
      let params = {
        pay_id: Number(this.taskInfoListM.m)
      }
      templatedata(params).then(res => {
        this.btnload = false
        if (res.Status == 200) {
          let temp = JSON.parse(res.Data.template_info)
          _this.keywording = []
          _this.keywording_ID = []
          _this.keywording_IMG = []
          _this.numbers = 0
          _this.taskInfoListM = temp
          let tips = temp.tips.split('+++')
          if (tips.length > 1) {
            temp.tips = temp.tips.split('+++')[0]
            _this.keywording = tips[1].split(',')
            _this.keywording_ID = tips[2].split(',')
            _this.keywording_IMG = tips[3].split(',')
            _this.numbers = _this.keywording.length
          }
          if (temp.nums.length == 7) {
            temp.nums.push({yj: {toNum: [],},}, {yj: {toNum: [],},}, {yj: {toNum: [],},}, {yj: {toNum: [],},}, {yj: {toNum: [],},}, {yj: {toNum: [],},}, {yj: {toNum: [],},}, {yj: {toNum: [],},},)
          }
          if (temp.keywords.length == 7) {
            temp.keywords.push({keyword: ''}, {keyword: ''}, {keyword: ''}, {keyword: ''}, {keyword: ''}, {keyword: ''}, {keyword: ''}, {keyword: ''})
          }
          console.log(temp);
          let count = 0
          temp.keywords.forEach((item) => {
            if (item.keyword != '') {
              count++
            }
          })
          if (count == 0) {
            _this.tasknum = count + 1
          } else {
            _this.tasknum = count
          }
          _this.taskInfoListM.time = new Date(new Date().toLocaleDateString()).getTime()
          _this.ruleForm.babyId = temp.babyId;
          _this.ruleForm.shop = temp.shop;
          if (_this.ruleForm.shop != '') {
            _this.taskvarietys('XLD')
          }
          _this.ruleForm.money = temp.money;
          _this.ruleForm.babyName = temp.babyName;
          _this.ruleForm.img = temp.img;
        }
      })
    },
    //添加保存模板
    saveTemplate() {
      let _this = this;
      console.log(_this.keywording);
      console.log(_this.keywording_ID);
      console.log(_this.keywording_IMG);
      this.$prompt("请输入模板名称(同一个宝贝链接只允许保存一个模板，如果已经存在将会被覆盖！)", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消"
      }).then(({value}) => {
        _this.taskInfoListM.babyId = _this.ruleForm.babyId
        _this.taskInfoListM.shop = _this.ruleForm.shop
        _this.taskInfoListM.money = _this.ruleForm.money
        _this.taskInfoListM.babyName = _this.ruleForm.babyName
        _this.taskInfoListM.img = _this.ruleForm.img
        if (_this.keywording != 0 && _this.keywording_ID != 0 && _this.keywording_IMG != 0) {
          _this.taskInfoListM.tips = _this.taskInfoListM.tips + '+++' + _this.keywording + '+++' + _this.keywording_ID + '+++' + _this.keywording_IMG
        }
        let params = {
          template_name: value,
          template_info: JSON.stringify(_this.taskInfoListM),
          link: _this.taskInfoListM.babyId,
        }
        savetemplate(params).then(res => {
          if (res.Status == 200) {
            this.$message.success(res.Message)
            this.getTemplateList()
          } else {
            this.$message.error(res.Message)
          }
        })
      })
    },
    addTaskM(formName) {
      let _this = this;
      if (!_this.payOk) {
        _this.$message({
          type: "error",
          message: "请先支付"
        });
        return;
      } else {
        _this.taskInfoListM.babyId = _this.ruleForm.babyId;
        _this.taskInfoListM.shop = _this.ruleForm.shop;
        _this.taskInfoListM.money = _this.ruleForm.money;
        _this.taskInfoListM.babyName = _this.ruleForm.babyName;
        _this.taskInfoListM.img = _this.ruleForm.img;
        _this.payOk = false;
        var releasetasksParams = {
          Data: JSON.stringify(_this.taskInfoListM),
        }
        releasetasks(releasetasksParams).then(res => {
          if (res.Status == 200) {
            _this.payOk = true;
          }
          let str = ''
          str = res.Message.replace(/#￥/g, '\n');
          _this.$message({
            type: res.Status,
            message: str
          })
          _this.dialogTask1 = false
          _this.payOk = false

        })
      }
    },
    getShopInfo(val) {
      let _this = this
      if (val == 'XLD') {
        var url = "https://detail.tmall.com/item.htm?id=" + _this.ruleForm.babyId
        window.open(url)
      }
      if (val == 'PJD') {
        var url = "https://detail.tmall.com/item.htm?id=" + _this.ruleFormPld.babyid
        window.open(url)
      }
    },
    getCommission() {
      let _this = this;
      usergetpriceinfo().then(res => {
        _this.commission = res.Data.info
        _this.money = res.Data.money
      })
    },
    getMoney(a) {
      let _this = this;
      let money = 0;
      switch (true) {
        case a <= 20 && 0 <= a:
          money = _this.commission[0];
          break;
        case a <= 50 && 20.1 < a :
          money = _this.commission[1];
          break;
        case a <= 100 && 50.1 < a :
          money = _this.commission[2];
          break;
        case a <= 150 && 100.1 < a :
          money = _this.commission[3];
          break;
        case  a <= 200 && 150.1 < a :
          money = _this.commission[4];
          break;
        case  a <= 250 && 200.1 < a:
          money = _this.commission[5];
          break;
        case a <= 300 && 250.1 < a :
          money = _this.commission[6];
          break;
        case a <= 350 && 300.1 < a:
          money = _this.commission[7];
          break;
        case a <= 400 && 350.1 < a :
          money = _this.commission[8];
          break;
        case a <= 450 && 400.1 < a :
          money = _this.commission[9];
          break;
        case a <= 500 && 450.1 < a :
          money = _this.commission[10];
          break;
        case a <= 550 && 500.1 < a :
          money = _this.commission[11];
          break;
        case a <= 600 && 550.1 < a :
          money = _this.commission[12];
          break;
        case a <= 650 && 600.1 < a :
          money = _this.commission[13];
          break;
        case a <= 700 && 650.1 < a :
          money = _this.commission[14];
          break;
        case a <= 750 && 700.1 < a:
          money = _this.commission[15];
          break;
        case a <= 800 && 750.1 < a :
          money = _this.commission[16];
          break;
        case a <= 850 && 800.1 < a :
          money = _this.commission[17];
          break;
        case a <= 900 && 850.1 < a :
          money = _this.commission[18];
          break;
        case a <= 1000 && 950.1 < a :
          money = _this.commission[19];
          break;
        case 1000 < a :
          money = _this.commission[19];
          break;
        default:
          money = _this.commission[19];
          break;
      }
      return money;
    },
    getShopList() {
      let _this = this;
      let params = {
        type: "tb"
      }
      shoplist(params).then(res => {
        res.Data.forEach((item) => {
          if (item.site_type == 'tb') {
            _this.tableData4.push(item)
          }
        })
      })
    },
    //获取用户信息
    getUser() {
      userinfo().then(res => {
        if (res.Status == 200) {
          this.$store.commit('Money', JSON.stringify(res.Data.Money))
          this.$emit('getMoney', res.Data.Money)
        } else {
          this.$message.error(res.Message)
        }
      })
    },
    getTaskNum() {
      let _this = this;
      return (
        _this.TaskNum = _this.sum(_this.taskInfoListM.nums[0].yj.toNum)
          +
          _this.sum(_this.taskInfoListM.nums[1].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[2].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[3].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[4].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[5].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[6].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[14].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[7].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[8].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[9].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[10].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[11].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[12].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[13].yj.toNum)
      );
    },
    //预计本金
    getTaskMoney() {
      let _this = this;
      _this.TaskMoney =
        (_this.ruleForm.money * 1) *
        (_this.sum(_this.taskInfoListM.nums[0].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[1].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[2].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[3].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[4].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[5].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[6].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[7].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[8].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[9].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[10].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[11].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[12].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[13].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[14].yj.toNum))
      if (isNaN(_this.TaskMoney)) {
        _this.TaskMoney = 0;
      }
      return _this.TaskMoney.toFixed(2)
    },
    //预计佣金
    getTaskMoney2() {
      let _this = this;
      _this.TaskMoney2 =
        (_this.sum(_this.taskInfoListM.nums[0].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[1].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[2].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[3].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[4].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[5].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[6].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[7].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[8].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[9].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[10].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[11].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[12].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[13].yj.toNum) +
          _this.sum(_this.taskInfoListM.nums[14].yj.toNum)) *
        _this.getMoney(_this.ruleForm.money)
      return _this.TaskMoney2.toFixed(2)
    },
    //预计总金额
    getyjcMoney() {
      let _this = this;
      let money2 = _this.getTaskMoney2()
      let money = _this.getTaskMoney()
      if (_this.keywording != '' && _this.keywording_ID != '' && _this.keywording_IMG != '') {
        let res_money = Number(money) + Number(money2) + _this.numbers * Number(_this.taskvarietyData)
          + _this.Listplus
        return res_money.toFixed(2)
      } else {
        let res_money = Number(money) + Number(money2) + _this.ruleForm.pjdNum * 3 + _this.Listplus
        return res_money.toFixed(2)
      }
    },
    checking() {
      let _this = this
      let params = {
        pay_id: Number(this.$route.query.pay_task_id)
      }
      taskdate(params).then(res => {
        if (res.Status == 200) {
          let temp
          if (res.Data.template !== undefined) {
            temp = JSON.parse(res.Data.template)
          } else {
            temp = JSON.parse(res.Data)
          }
          _this.plusesList[0].radio = JSON.parse(res.Data.template).compare
          _this.plusesList[1].radio = JSON.parse(res.Data.template).actor
          _this.plusesList[2].radio = JSON.parse(res.Data.template).browse
          _this.plusesList[3].radio = JSON.parse(res.Data.template).shop_cart
          _this.plusesList[4].radio = JSON.parse(res.Data.template).favorites
          _this.plusesList[5].radio = Number(JSON.parse(res.Data.template).repeat)
          _this.plusesList[6].radio = JSON.parse(res.Data.template).generation
          let counts = null
          let type = res.Data.types
          console.log(JSON.parse(res.Data.template));
          if (type == '普通单') {
            _this.keywords = JSON.parse(res.Data.template).keywords.forEach((item) => {
              if (item.keyword != '') {
                counts++
              }
            })
            _this.tasknum = counts
          }
          if (type == '普通单') {
            console.log(type);
            _this.activeName = 'second'
            _this.taskInfoListM = temp
            if (_this.taskInfoListM.tips) {
              let tips = _this.taskInfoListM.tips.split('+++***').slice(1, 4)
              if (tips.length != 0) {
                _this.keywording = tips[0].split(',')
                _this.keywording_ID = tips[1].split(',')
                _this.keywording_IMG = tips[2].split(',')
                _this.taskInfoListM.tips = _this.taskInfoListM.tips.split('+++***')[0]
              }
            }
            _this.numbers = _this.keywording.length
            _this.ruleForm.babyId = temp.babyId;
            _this.ruleForm.shop = temp.shop;
            console.log(_this.ruleForm.shop);
            if (_this.ruleForm.shop) {
              _this.taskvarietys('XLD')
            }
            _this.ruleForm.money = temp.money;
            _this.ruleForm.babyName = temp.babyName;
            _this.ruleForm.img = temp.img;
          } else {
            if (type == '浏览单') {
              console.log(type);
              _this.activeName = 'first'
              _this.ruleFormLld.shoptitle = temp.goodsname
              _this.ruleFormLld.babyid = temp.baby_id
              _this.ruleFormLld.goodsprice = temp.price
              _this.ruleFormLld.shopname = temp.shopname
              _this.ruleFormLld.group = temp.group
              _this.ruleFormLld.goodskey = temp.key_world
              _this.ruleFormLld.goodsproblem = temp.problem_one
              _this.ruleFormLld.goodsanswer = temp.answer_one
              _this.ruleFormLld.sort = temp.sort_order
              _this.ruleFormLld.filter = temp.race_selection
              _this.ruleFormLld.img = temp.img
              _this.ruleFormLld.shoptips = temp.filter
              _this.ruleFormLld.acttime = temp.time

              temp.task_num.forEach((item, idx) => {
                _this.timearr[idx].num = item
              })
            } else if (type == '评价单') {
              console.log(type);
              _this.activeName = 'third'
              _this.ruleFormPld.shoptitle = temp.goodsname
              _this.ruleFormPld.babyid = temp.baby_id
              _this.ruleFormPld.goodsprice = temp.price
              _this.ruleFormPld.shopname = temp.shopname
              _this.ruleFormPld.group = temp.group
              _this.ruleFormPld.goodskey = temp.key_world
              _this.ruleFormPld.sort = temp.sort_order
              _this.ruleFormPld.filter = temp.race_selection
              _this.ruleFormPld.img = temp.img
              _this.ruleFormPld.shoptips = temp.filter
              _this.ruleFormPld.acttime = temp.time
              if (_this.ruleFormPld.shopname) {
                _this.taskvarietys('PJD')
              }
              temp.task_num.forEach((item, idx) => {
                _this.timearrP[idx].num = item
              })
            } else if (type == '隔夜单') {
              console.log(type);
              _this.activeName = 'fourth'
              _this.ruleFormGED.shoptitle = temp.goodsname
              _this.ruleFormGED.babyid = temp.baby_id
              _this.ruleFormGED.goodsprice = temp.price
              _this.ruleFormGED.shopname = temp.shopname
              _this.ruleFormGED.group = temp.group
              _this.ruleFormGED.orderway = temp.orderway
              _this.ruleFormGED.intervals = temp.intervals
              _this.ruleFormGED.goodskey = temp.key_world
              _this.ruleFormGED.sort = temp.sort_order
              _this.ruleFormGED.filter = temp.race_selection
              _this.ruleFormGED.img = temp.img
              _this.ruleFormGED.shoptips = temp.filter
              _this.ruleFormGED.acttime = temp.time
              if (_this.ruleFormGED.shopname) {
                _this.taskvarietys('JGD')
              }
              temp.task_num.forEach((item, idx) => {
                _this.timearrG[idx].num = item
              })
            }
          }
        } else {
          _this.$message.error(res.Message)
        }
      })
    },
    taskvarietys(name) {
      if (name == 'XLD') {
        let params = {
          shopname: this.ruleForm.shop
        }
        taskvariety(params).then((res) => {
          this.taskvarietyData = res.Data
          console.log(this.taskvarietyData);
          this.MoneyS = res.MoneyS
          this.plusesList.forEach((item) => {
            if (item.title == "货比三家") {
              this.$set(item, 'MoneyS', this.MoneyS.compare)
            } else if (item.title == "拍前聊天") {
              this.$set(item, 'MoneyS', this.MoneyS.actor)
            } else if (item.title == "浏览评价") {
              this.$set(item, 'MoneyS', this.MoneyS.browse)
            } else if (item.title == "加购物车") {
              this.$set(item, 'MoneyS', this.MoneyS.shop_cart)
            } else if (item.title == "收藏宝贝") {
              this.$set(item, 'MoneyS', this.MoneyS.favorites)
            } else if (item.title == "年龄筛选") {
              this.$set(item, 'MoneyS', this.MoneyS.generation)
            } else if (item.title == "性别筛选") {
              this.$set(item, 'MoneyS', 0)
            }
          })
        })
      } else if (name == 'PJD') {
        let params = {
          shopname: this.ruleFormPld.shopname
        }
        taskvariety(params).then((res) => {
          this.taskvarietyData = res.Data
          this.MoneyS = res.MoneyS
          this.plusesList.forEach((item) => {
            if (item.title == "货比三家") {
              this.$set(item, 'MoneyS', this.MoneyS.compare)
            } else if (item.title == "拍前聊天") {
              this.$set(item, 'MoneyS', this.MoneyS.actor)
            } else if (item.title == "浏览评价") {
              this.$set(item, 'MoneyS', this.MoneyS.browse)
            } else if (item.title == "加购物车") {
              this.$set(item, 'MoneyS', this.MoneyS.shop_cart)
            } else if (item.title == "收藏宝贝") {
              this.$set(item, 'MoneyS', this.MoneyS.favorites)
            } else if (item.title == "年龄筛选") {
              this.$set(item, 'MoneyS', this.MoneyS.generation)
            } else if (item.title == "性别筛选") {
              this.$set(item, 'MoneyS', 0)
            }
          })
          console.log(this.plusesList);
        })
      } else if (name == 'JGD') {
        console.log(name);
        let params = {
          shopname: this.ruleFormGED.shopname
        }
        taskvariety(params).then((res) => {
          this.taskvarietyData = res.Data
          this.MoneyS = res.MoneyS
          this.plusesList.forEach((item) => {
            if (item.title == "货比三家") {
              this.$set(item, 'MoneyS', this.MoneyS.compare)
            } else if (item.title == "拍前聊天") {
              this.$set(item, 'MoneyS', this.MoneyS.actor)
            } else if (item.title == "浏览评价") {
              this.$set(item, 'MoneyS', this.MoneyS.browse)
            } else if (item.title == "加购物车") {
              this.$set(item, 'MoneyS', this.MoneyS.shop_cart)
            } else if (item.title == "收藏宝贝") {
              this.$set(item, 'MoneyS', this.MoneyS.favorites)
            } else if (item.title == "年龄筛选") {
              this.$set(item, 'MoneyS', this.MoneyS.generation)
            } else if (item.title == "性别筛选") {
              this.$set(item, 'MoneyS', 0)
            }
          })
        })
      }
    },
  },
  mounted() {
    this.getCommission();
    this.getShopList();
    this.getTemplateList()
    if (this.$route.query.pay_task_id != undefined) {
      this.checking()
    }
    let myDate = new Date();
    this.Month = myDate.getMonth() + 1;
    this.DateDay = myDate.getDate();
    this.activeDate = this.DateDay;
    let now = new Date();
    this.ruleFormPld.acttime = now.setHours(0, 0, 0, 0);
    this.taskInfoListM.time = now.setHours(0, 0, 0, 0);
    switch (true) {
      case [1, 3, 5, 7, 8, 10, 12].indexOf(this.Month) != -1:
        this.dayNum = 31;
        break;
      case [4, 6, 9, 11].indexOf(this.Month) != -1:
        this.dayNum = 30;
        break;
      default:
        if (myDate.getFullYear() % 4 == 0) {
          this.dayNum = 29;
        }
        this.dayNum = 28;
        break;
    }
    this.getUser()
  },
};
</script>

<style lang="scss">
.el-textarea__inner {
  height: 150px;
}

.messages {
  .el-form-item__label {
    opacity: 0;
  }
}

.adminTask {
  .pluses {
    border: 1px solid #ccc;
    padding: 15px 50px;
    margin-bottom: 20px;
  }

  .lldstyle {
    display: flex;
    justify-content: space-between;

    .lldtime {
      overflow: hidden;
    }

    .partones {
      float: left;
      display: flex;
      flex-direction: column;
      text-align: center;
      width: 120px;
      margin-right: 30px;

      span {
        background: #F56C6C;
        line-height: 26px;
        color: #fff;
        border-top-right-radius: 5px;
        border-top-left-radius: 5px;
      }

      input {
        border: 1px solid #ccc;
        line-height: 65px;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        text-align: center;
      }
    }

    .partone {
      float: left;
      display: flex;
      flex-direction: column;
      text-align: center;
      width: 120px;
      margin-right: 30px;

      span {
        background: rgb(64, 158, 225);
        line-height: 26px;
        color: #fff;
        border-top-right-radius: 5px;
        border-top-left-radius: 5px;
      }

      input {
        border: 1px solid #ccc;
        line-height: 65px;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        text-align: center;
      }
    }
  }

  .paperz {
    height: 90%;
    padding: 15px;
  }

  .demo-table-expand {
    font-size: 0;
    margin-left: 49.5px;
  }

  .demo-table-expand label {
    width: 90px;
    color: #99a9bf;
  }

  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 100%;
  }

  .taskDialog {
    width: 760px;
  }

  .taskDialog1 {
    width: 1315.5px;
  }

  .taskDialog2 {
    width: 1315.5px;
  }

  //   .adminTask .el-form-item__content{
  //     // margin-top:-13px;
  //   }
  //   .el-button{
  //     // margin-top:-13px;
  //   }
  .el-dialog__body {
    display: flex;
    justify-content: center;
  }

  .el-dialog__body .el-form {
    flex: 1;
  }

  .el-dialog__body .tttt .el-dialog__body {
    padding: 5px;
  }

  .tttt .el-form-item {
    margin-bottom: 6px;
  }

  .tttt .el-form-item__label {
    line-height: 23px;
  }

  .tttt .el-form-item__content {
    line-height: 23px;
  }

  .el-select__caret {
    margin-left: -20px !important;
  }

  .blcok {
    margin: 10px 30px;
    border: 1px solid #d8d8d8;
    padding: 10px 0 0 20px;
  }

  .blockone {
    text-align: center;
  }

  .el-input--mini .el-input__icon {
    line-height: 14px;
  }

  .el-select .el-input .el-select__caret {
    margin-left: -105px;
  }

  .el-radio + .el-radio {
    margin-left: 10px;
  }

  .activeDateClass {
    color: #fff;
    background-color: #409eff;
    border-color: #409eff;
  }

  .activeDateClass:hover {
    color: #fff;
    background-color: #409eff;
  }

  .el-input.is-disabled .el-input__inner {
    color: #6a6d73;
    width: 103%;
  }

  // .el-dialog__body {
  //   padding-bottom: 0;
  // }

  .el-dialog__footer {
    text-align: left;
  }

  .Puttingtime {
    display: inline-block;
    width: 52px;
    text-align: center;
  }

  .el-dialog__footer {
    padding: 0 22px 8px;
  }

  .el-form-item__content {
    line-height: 20px;
  }

  .task_total span {
    margin: 0 5px;
    color: #3f35f4;
  }

  .tipsShow {
    color: #3f35f4;
  }

  .el-form-item--mini {
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }

  .el-form-item__content {
    margin-left: 0 !important;
  }

  .el-table .cell {
    text-align: center;
  }

  .el-form-item__error {
    padding-top: 4px;
  }

  .el-textarea__inner {
    height: 50px;
  }

  .formInput {
    width: 190px;
    outline: none;
    margin-left: -12px;
    border-radius: 4px;
    padding: 0 15px;
    line-height: 26px;
    border: 1px solid #dcdfe6;
    background-size: 13px 13px;
    background-repeat: no-repeat;
  }

  .formInput:focus {
    border-color: #409eff;
  }

  .formInput_error {
    border-color: #f56c6c !important;
    background: url("../../../assets/form_error.png") 165px no-repeat;
    background-size: 14px 14px;
  }

  .formInput_true {
    border-color: #67c23a !important;
    background: url("../../../assets/form_true.png") 165px no-repeat;
    background-size: 14px 14px;
  }

  .adminTask .el-form-item__content {
    position: relative;
  }

  .formerror_box {
    display: none;
    position: absolute;
    color: #f56c6c;
    font-size: 12px;
  }

  .backupdedleteUserDialog {
    width: 500px;
  }

  .el-dialog {
    position: relative;
    margin: 0 auto 50px;
    background: #FFF;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    box-sizing: border-box;
    width: 80%;
  }
}
</style>
<style>
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

input[type='number'] {
  -moz-appearance: textfield;
}

.el-textarea__inner {
  height: 150px !important;
}

.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #409EFF;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 100px;
  height: 100px;
  line-height: 100px;
  text-align: center;
}

.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>
